package com.csc.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;

import org.springframework.stereotype.Repository;

import com.csc.domain.SystemAccountType;

@Repository
public class SystemAccountTypeDAOImpl implements SystemAccountTypeDAO{
	
	@PersistenceContext
	private EntityManager em;
	
	@Transactional
	public List<SystemAccountType> getAccountsType(){
		TypedQuery<SystemAccountType> query = em.createQuery(
				"Select p From SystemAccountType p", SystemAccountType.class);
		return query.getResultList();
	}
	
	/*@author:Tran Son Hoang ---action: get system account type*/
	@Transactional
	public SystemAccountType getTypeByID(int Id) {
		// TODO Auto-generated method stub
		SystemAccountType systype = em.find(SystemAccountType.class, Id);
		return systype;
	}
}
